<!DOCTYPE html>
<html lang="">

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
  <link rel="icon" href="<%= BASE_URL %>favicon.ico">
  <title>
    <%= htmlWebpackPlugin.options.title %>
  </title>
</head>

<body>
  <noscript>
    <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
        Please enable it to continue.</strong>
  </noscript>
  <div id="app"></div>
  <script>
    //监听手机返回键
    document.addEventListener("plusready", function () {
      $scope.webview = plus.webview.currentWebview();
      plus.key.addEventListener('backbutton', function () {
        $scope.webview.canBack(function (e) {
          if ($rootScope.nowState.name == 'Main0') {
            //首次按键，提示‘再按一次退出应用’
            if (!$scope.first) {
              $scope.first = new Date().getTime();
              plus.nativeUI.toast('再按一次退出应用');
              setTimeout(function () {
                $scope.first = null;
              }, 1000);
            } else {
              plus.runtime.quit();
            }
          } else if (e.canBack && localStorage.getItem('uid') && localStorage.getItem('openid')) {
            $scope.webview.back();
          } else {
            plus.runtime.quit();
          }
        })
      });
    });
  </script>
</body>

</html>